//----------------------------------------------------------------------------------------------------------------------
// Copyright (c) 2012 James Whitworth
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//----------------------------------------------------------------------------------------------------------------------
#include "gmock/gmock.h"
#include "sqbind/sqbBind.h"
#include "../fixtures/SquirrelFixture.h"
#include "../mocks/autogen/MockFunction10.h"
//----------------------------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------------------
// THIS FILE IS AUTO GENERATED DO NOT EDIT.
//----------------------------------------------------------------------------------------------------------------------

namespace autogen
{
//----------------------------------------------------------------------------------------------------------------------
typedef SquirrelFixture BindFunctionTest;

//----------------------------------------------------------------------------------------------------------------------
typedef SquirrelFixture BindClassFunctionTest;

//----------------------------------------------------------------------------------------------------------------------
typedef SquirrelFixture BindSingletonFunctionTest;

//----------------------------------------------------------------------------------------------------------------------
// Test10ParametersReturnVoid
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindFunctionTest, Test10ParametersReturnVoid)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  OtherBoundClass invalidParameter;
  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  EXPECT_CALL(mock, ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .Times(2);

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  EXPECT_TRUE(sqb::Bind::BindFunction(m_vm, -1, &MockFunction10::VoidFunction10, _SC("VoidFunction10")));

  sq_pushstring(m_vm, _SC("Mock"), -1);
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_TRUE(sqb::Bind::BindFunction(m_vm, 3, &MockFunction10::VoidFunction10, _SC("VoidFunction10")));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_rawset(m_vm, -3));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &invalidParameter, _SC("invalidParameter")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  CompileAndSucceedCall("VoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CompileAndSucceedCall("Mock.VoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");

  CompileAndFailCall("VoidFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("VoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
}

//----------------------------------------------------------------------------------------------------------------------
// Test10ParametersReturnVoid
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindClassFunctionTest, Test10ParametersReturnVoid)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  OtherBoundClass invalidParameter;
  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  EXPECT_CALL(mock, ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .Times(1);
  EXPECT_CALL(mock, ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .Times(1);

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  // bind the mock class
  //
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_settypetag(m_vm, -1, sqb::ClassTypeTag<MockFunction10>::Get()));
  HSQOBJECT class_object;
  sq_getstackobj(m_vm, -1, &class_object);
  sqb::ClassTypeTag<MockFunction10>::Get()->SetClassObject(m_vm, class_object);
  EXPECT_TRUE(sqb::Bind::BindClassFunction<MockFunction10>(m_vm, -1, &MockFunction10::ClassVoidFunction10, _SC("ClassVoidFunction10")));
  EXPECT_TRUE(sqb::Bind::BindClassFunction<MockFunction10>(m_vm, 2, &MockFunction10::ConstClassVoidFunction10, _SC("ConstClassVoidFunction10")));
  sq_poptop(m_vm);

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, static_cast<MockFunction10 *>(&mock), _SC("mock")));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &invalidParameter, _SC("invalidParameter")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  CompileAndSucceedCall("mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CompileAndSucceedCall("mock.ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");

  CompileAndFailCall("mock.ClassVoidFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
}

//----------------------------------------------------------------------------------------------------------------------
// Test10ParametersReturnVoid
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindSingletonFunctionTest, Test10ParametersReturnVoid)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  OtherBoundClass invalidParameter;
  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  EXPECT_CALL(mock, ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .Times(1);
  EXPECT_CALL(mock, ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .Times(1);

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  // bind the mock class
  //
  sq_pushstring(m_vm, _SC("Mock"), -1);
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_TRUE(sqb::Bind::BindSingletonFunction<MockFunction10>(m_vm, -1, &mock, &MockFunction10::ClassVoidFunction10, _SC("ClassVoidFunction10")));
  EXPECT_TRUE(sqb::Bind::BindSingletonFunction<MockFunction10>(m_vm, 1, &mock, &MockFunction10::ConstClassVoidFunction10, _SC("ConstClassVoidFunction10")));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_rawset(m_vm, -3));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &invalidParameter, _SC("invalidParameter")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  CompileAndSucceedCall("Mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CompileAndSucceedCall("ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");

  CompileAndFailCall("Mock.ClassVoidFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassVoidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
}

//----------------------------------------------------------------------------------------------------------------------
// Test10Parameters
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindFunctionTest, Test10Parameters)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  OtherBoundClass invalidParameter;
  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  BoundClass expected_result(0xffffffff);
  EXPECT_CALL(mock, ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .Times(2)
    .WillRepeatedly(::testing::Return(expected_result));

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  EXPECT_TRUE(sqb::Bind::BindFunction(m_vm, -1, &MockFunction10::Function10, _SC("Function10")));

  sq_pushstring(m_vm, _SC("Mock"), -1);
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_TRUE(sqb::Bind::BindFunction(m_vm, 3, &MockFunction10::Function10, _SC("Function10")));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_rawset(m_vm, -3));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &invalidParameter, _SC("invalidParameter")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  BoundClass actual_result = CompileAndCallReturnResult<BoundClass>("return Function10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  EXPECT_EQ(expected_result, actual_result);
  actual_result = CompileAndCallReturnResult<BoundClass>("return Mock.Function10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  EXPECT_EQ(expected_result, actual_result);

  CompileAndFailCall("Function10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Function10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
}

//----------------------------------------------------------------------------------------------------------------------
// Test10Parameters
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindClassFunctionTest, Test10Parameters)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  OtherBoundClass invalidParameter;
  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  BoundClass expected_result(0xffffffff);
  EXPECT_CALL(mock, ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .WillOnce(::testing::Return(expected_result));
  EXPECT_CALL(mock, ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .WillOnce(::testing::Return(expected_result));

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  // bind the mock class
  //
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_settypetag(m_vm, -1, sqb::ClassTypeTag<MockFunction10>::Get()));
  HSQOBJECT class_object;
  sq_getstackobj(m_vm, -1, &class_object);
  sqb::ClassTypeTag<MockFunction10>::Get()->SetClassObject(m_vm, class_object);
  EXPECT_TRUE(sqb::Bind::BindClassFunction<MockFunction10>(m_vm, -1, &MockFunction10::ClassFunction10, _SC("ClassFunction10")));
  EXPECT_TRUE(sqb::Bind::BindClassFunction<MockFunction10>(m_vm, 2, &MockFunction10::ConstClassFunction10, _SC("ConstClassFunction10")));
  sq_poptop(m_vm);

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, static_cast<MockFunction10 *>(&mock), _SC("mock")));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &invalidParameter, _SC("invalidParameter")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  BoundClass actual_result = CompileAndCallReturnResult<BoundClass>("return mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  EXPECT_EQ(expected_result, actual_result);
  actual_result = CompileAndCallReturnResult<BoundClass>("return mock.ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  EXPECT_EQ(expected_result, actual_result);

  CompileAndFailCall("mock.ClassFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("mock.ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
}

//----------------------------------------------------------------------------------------------------------------------
// Test10Parameters
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindSingletonFunctionTest, Test10Parameters)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  OtherBoundClass invalidParameter;
  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  BoundClass expected_result(0xffffffff);
  EXPECT_CALL(mock, ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .WillOnce(::testing::Return(expected_result));
  EXPECT_CALL(mock, ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .WillOnce(::testing::Return(expected_result));

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  // bind the mock class
  //
  sq_pushstring(m_vm, _SC("Mock"), -1);
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_TRUE(sqb::Bind::BindSingletonFunction<MockFunction10>(m_vm, -1, &mock, &MockFunction10::ClassFunction10, _SC("ClassFunction10")));
  EXPECT_TRUE(sqb::Bind::BindSingletonFunction<MockFunction10>(m_vm, 1, &mock, &MockFunction10::ConstClassFunction10, _SC("ConstClassFunction10")));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_rawset(m_vm, -3));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &invalidParameter, _SC("invalidParameter")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  BoundClass actual_result = CompileAndCallReturnResult<BoundClass>("return Mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  EXPECT_EQ(expected_result, actual_result);
  actual_result = CompileAndCallReturnResult<BoundClass>("return ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  EXPECT_EQ(expected_result, actual_result);

  CompileAndFailCall("Mock.ClassFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(invalidParameter, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 1 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, invalidParameter, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 2 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, parameter1, invalidParameter, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 3 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, parameter1, parameter2, invalidParameter, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 4 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, invalidParameter, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 5 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, invalidParameter, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 6 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, invalidParameter, parameter7, parameter8, parameter9)");
  CheckErrorString("parameter 7 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, invalidParameter, parameter8, parameter9)");
  CheckErrorString("parameter 8 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, invalidParameter, parameter9)");
  CheckErrorString("parameter 9 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");

  CompileAndFailCall("Mock.ClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
  CompileAndFailCall("ConstClassFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, invalidParameter)");
  CheckErrorString("parameter 10 has an invalid type 'OtherBoundClass' ; expected: 'BoundClass'");
}

//----------------------------------------------------------------------------------------------------------------------
// Test10ParametersReturnInvalid
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindFunctionTest, Test10ParametersReturnInvalid)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  InvalidStackUtilsClass expected_result;
  EXPECT_CALL(mock, ClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .Times(2)
    .WillRepeatedly(::testing::Return(expected_result));

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  EXPECT_TRUE(sqb::Bind::BindFunction(m_vm, -1, &MockFunction10::InvalidFunction10, _SC("InvalidFunction10")));

  sq_pushstring(m_vm, _SC("Mock"), -1);
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_TRUE(sqb::Bind::BindFunction(m_vm, 3, &MockFunction10::InvalidFunction10, _SC("InvalidFunction10")));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_rawset(m_vm, -3));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  CompileAndFailCall("InvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("error returning object of type 'InvalidStackUtilsClass'");
  CompileAndFailCall("Mock.InvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("error returning object of type 'InvalidStackUtilsClass'");
}

//----------------------------------------------------------------------------------------------------------------------
// Test10ParametersReturnInvalid
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindClassFunctionTest, Test10ParametersReturnInvalid)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  InvalidStackUtilsClass expected_result;
  EXPECT_CALL(mock, ClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .WillOnce(::testing::Return(expected_result));
  EXPECT_CALL(mock, ConstClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .WillOnce(::testing::Return(expected_result));

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  // bind the mock class
  //
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_settypetag(m_vm, -1, sqb::ClassTypeTag<MockFunction10>::Get()));
  HSQOBJECT class_object;
  sq_getstackobj(m_vm, -1, &class_object);
  sqb::ClassTypeTag<MockFunction10>::Get()->SetClassObject(m_vm, class_object);
  EXPECT_TRUE(sqb::Bind::BindClassFunction<MockFunction10>(m_vm, -1, &MockFunction10::ClassInvalidFunction10, _SC("ClassInvalidFunction10")));
  EXPECT_TRUE(sqb::Bind::BindClassFunction<MockFunction10>(m_vm, 2, &MockFunction10::ConstClassInvalidFunction10, _SC("ConstClassInvalidFunction10")));
  sq_poptop(m_vm);

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, static_cast<MockFunction10 *>(&mock), _SC("mock")));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  CompileAndFailCall("mock.ClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("error returning object of type 'InvalidStackUtilsClass'");
  CompileAndFailCall("mock.ConstClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("error returning object of type 'InvalidStackUtilsClass'");
}

//----------------------------------------------------------------------------------------------------------------------
// Test10ParametersReturnInvalid
//----------------------------------------------------------------------------------------------------------------------
TEST_F(BindSingletonFunctionTest, Test10ParametersReturnInvalid)
{
  ::testing::StrictMock<MockFunction10> mock;
  MockFunction10::m_instance = &mock;

  sq_pushroottable(m_vm);
  sqb::Bind::BindClass<BoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("BoundClass"));
  sqb::Bind::BindClass<OtherBoundClass, sqb::NoBaseClass>(m_vm, -1, _SC("OtherBoundClass"));
  sq_poptop(m_vm);

  BoundClass parameter0(0);
  BoundClass parameter1(1);
  BoundClass parameter2(2);
  BoundClass parameter3(3);
  BoundClass parameter4(4);
  BoundClass parameter5(5);
  BoundClass parameter6(6);
  BoundClass parameter7(7);
  BoundClass parameter8(8);
  BoundClass parameter9(9);

  InvalidStackUtilsClass expected_result;
  EXPECT_CALL(mock, ClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .WillOnce(::testing::Return(expected_result));
  EXPECT_CALL(mock, ConstClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9))
    .WillOnce(::testing::Return(expected_result));

  // bind the objects required for calling the function
  //
  sq_pushroottable(m_vm);

  // bind the mock class
  //
  sq_pushstring(m_vm, _SC("Mock"), -1);
  EXPECT_SQ_SUCCEEDED(m_vm, sq_newclass(m_vm, SQFalse));
  EXPECT_TRUE(sqb::Bind::BindSingletonFunction<MockFunction10>(m_vm, -1, &mock, &MockFunction10::ClassInvalidFunction10, _SC("ClassInvalidFunction10")));
  EXPECT_TRUE(sqb::Bind::BindSingletonFunction<MockFunction10>(m_vm, 1, &mock, &MockFunction10::ConstClassInvalidFunction10, _SC("ConstClassInvalidFunction10")));
  EXPECT_SQ_SUCCEEDED(m_vm, sq_rawset(m_vm, -3));

  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter0, _SC("parameter0")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter1, _SC("parameter1")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter2, _SC("parameter2")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter3, _SC("parameter3")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter4, _SC("parameter4")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter5, _SC("parameter5")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter6, _SC("parameter6")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter7, _SC("parameter7")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter8, _SC("parameter8")));
  EXPECT_TRUE(sqb::Bind::BindVariable(m_vm, -1, &parameter9, _SC("parameter9")));
  sq_poptop(m_vm);

  CompileAndFailCall("Mock.ClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("error returning object of type 'InvalidStackUtilsClass'");
  CompileAndFailCall("ConstClassInvalidFunction10(parameter0, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9)");
  CheckErrorString("error returning object of type 'InvalidStackUtilsClass'");
}

} // namespace autogen
